﻿using ServiceCore;
using System;
using System.Collections.Generic;
using System.Text;

namespace Entity.Sale
{
    public enum sale_work_state_enum
    {
        已新建未处理 = 0,
        //工单待审核 = 1,

        审批处理中 = 2,
        审批完成 = 3,
        审批被驳回 = 4,
        审批关闭 = 5,

        生产已接单 = 10,
        生产中 = 11,
        生产完成 = 12,
        质检完成 = 13,
        生产关闭 = 14,
        生产退回 = 15,

        待发货 = 20,
        已发货 = 21,
        已收货 = 22
    }
    /// <summary>
    ///  工单审核状态
    /// </summary>
    public enum work_order_approval
    {
        待审核 = 2,
        已转生产 = 3,
        退回 = 4,
        关闭 = 5
    }
    /// <summary>
    /// 生产状态
    /// </summary>
    public enum work_state
    {
        待接单 = 3,
        生产已接单 = 10,
        生产中 = 11,
        生产完成 = 12,
        质检完成 = 13,
        生产关闭 = 14,
        生产退回 = 15
    }
    /// <summary>
    /// 物流状态
    /// </summary>
    public enum logistics_state
    {
        待发货 = 20,
        已发货 = 21,
        已收货 = 22
    }

    /// <summary>
    /// 工单
    /// </summary>
    public class sale_work_order
    {
        public string work_order_id { get; set; }

        /// <summary>
        /// 指定生产客户ID
        /// </summary>
        public string baseuserid { get; set; }
        /// <summary>
        /// 生产客户名
        /// </summary>
        public string baseusername { get; set; }

        /// <summary>
        /// 添加人
        /// </summary>
        public string add_uid { get; set; }
        /// <summary>
        /// 指定机器名称
        /// </summary>
        public string mch_name { get; set; }
        /// <summary>
        /// 指定机器ID
        /// </summary>
        public string mch_id { get; set; }
        /// <summary>
        /// 总体状态
        /// </summary>
        public sale_work_state_enum total_state { get; set; }

        /// <summary>
        /// 工单审核状态
        /// </summary>
        public work_order_approval? work_approval_state { get; set; }
        /// <summary>
        /// 工作状态 
        /// </summary>
        public work_state? work_state { get; set; }
        /// <summary>
        /// 物流状态
        /// </summary>
        public logistics_state? logistics_state { get; set; }
        /// <summary>
        /// 发货批号
        /// </summary>
        public string send_No { get; set; }


        /// <summary>
        /// 省
        /// </summary>
        public string province { get; set; }
        /// <summary>
        /// 市
        /// </summary>
        public string city { get; set; }
        /// <summary>
        /// 区
        /// </summary>
        public string district { get; set; }
        /// <summary>
        /// 地址
        /// </summary>
        public string address { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string work_order_mark { get; set; }

        public string approval_uid { get; set; }

        public string approval_name { get; set; }

        /// <summary>
        /// 转生产负责人
        /// </summary>
        public string work_uid { get; set; }
        /// <summary>
        /// 转生产人名称
        /// </summary>
        public string work_name { get; set; }
        /// <summary>
        ///  发货时间
        /// </summary>
        public DateTime? send_time { get; set; }
        /// <summary>
        /// 添加时间
        /// </summary>
        public DateTime addtime { get; set; }
        /// <summary>
        /// 工期时间
        /// </summary>
        public DateTime? work_end_time { get; set; }
        /// <summary>
        /// 审核完成时间
        /// </summary>
        public DateTime? approval_end_time { get; set; }
        /// <summary>
        /// 审核关闭时间
        /// </summary>
        public DateTime? approval_cloes_time { get; set; }
        /// <summary>
        /// 审核退回时间
        /// </summary>
        public DateTime? approval_back_time { get; set; }
        /// <summary>
        /// 生产单接单时间
        /// </summary>
        public DateTime? work_get_time { get; set; }
        /// <summary>
        /// 生成生产单时间
        /// </summary>
        public DateTime? create_order_time { get; set; }
        /// <summary>
        /// 生产中时间绑定机器码事件
        /// </summary>
        public DateTime? working_time { get; set; }
        /// <summary>
        /// 质检完成时间
        /// </summary>
        public DateTime? QA_end_time { get; set; }
        /// <summary>
        /// 实际生产完成时间
        /// </summary>
        public DateTime? true_work_end_time { get; set; }
        /// <summary>
        /// 生产关闭时间
        /// </summary>
        public DateTime? work_close_time { get; set; }
        /// <summary>
        /// 生产退回时间
        /// </summary>
        public DateTime? work_back_time { get; set; }
    }

    /// <summary>
    /// 
    /// </summary>
    public class sale_work_order_details
    {
        /// <summary>
        ///  工单详情id
        /// </summary>
        public string work_order_details_id { get; set; }
        /// <summary>
        /// 工单ID 
        /// </summary>
        public string work_order_id { get; set; }
        /// <summary>
        /// 显示在纸张上的生产单号
        /// </summary>
        public string print_work_No { get; set; }
        /// <summary>
        /// 单体描述 例如主柜  第1副柜 第2副柜等
        /// </summary>
        public string des { get; set; }
        /// <summary>
        /// 货道设置 储存计算后的货道数组
        /// </summary>
        public string slot_set { get; set; }
        /// <summary>
        /// 添加时间
        /// </summary>
        public DateTime addtime { get; set; }
        /// <summary>
        /// 添加人
        /// </summary>
        public string add_uid { get; set; }
        /// <summary>
        /// 货道模板id
        /// </summary>
        public string slot_template_id { get; set; }
        /// <summary>
        /// 生产备注
        /// </summary>
        public string work_mark { get; set; }

        /// <summary>
        /// 柜体编号
        /// </summary>
        public int box_No { get; set; }
        /// <summary>
        /// 柜体码
        /// </summary>
        public string box_id { get; set; }
        /// <summary>
        /// 颜色
        /// </summary>
        public string color { get; set; }
        /// <summary>
        /// 制冷
        /// </summary>
        public bool can_cold { get; set; }
        /// <summary>
        /// 制热
        /// </summary>
        public bool can_hot { get; set; }
        /// <summary>
        /// 是否负离子
        /// </summary>
        public bool can_anion { get; set; }
        /// <summary>
        /// 是否具备现金功能
        /// </summary>
        public bool can_cash { get; set; }
        /// <summary>
        /// 机器类型
        /// </summary>
        public Mch_Type Mch_Type { get; set; }
        /// <summary>
        /// 机器类型
        /// </summary>
        public string mch_kid_type { get; set; }
        /// <summary>
        /// 机器类型id (选择时使用)
        /// </summary>
        public string mch_kid_type_id { get; set; }
    }


    public class get_details_model : sale_work_order_details
    {
        public string u_name { get; set; }

        public string baseusername { get; set; }

        public string mch_name { get; set; }

        public DateTime? work_get_time { get; set; }

        public DateTime? work_end_time { get; set; }
        /// <summary>
        /// 省
        /// </summary>
        public string province { get; set; }
        /// <summary>
        /// 市
        /// </summary>
        public string city { get; set; }
        /// <summary>
        /// 区
        /// </summary>
        public string district { get; set; }
        /// <summary>
        /// 地址
        /// </summary>
        public string address { get; set; }
        public string work_order_mark { get; set; }
        public string barcode { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string slot_group { get; set; }
    }


    public class create_mch_params
    {

        public string work_order_id { get; set; }
        /// <summary>
        /// 机器名称
        /// </summary>
        public string mchname { get; set; }
        /// <summary>
        /// 省
        /// </summary>
        public string province { get; set; }
        /// <summary>
        /// 市
        /// </summary>
        public string city { get; set; }
        /// <summary>
        /// 区
        /// </summary>
        public string district { get; set; }
        /// <summary>
        /// 详细地址
        /// </summary>
        public string address { get; set; }
        /// <summary>
        /// 生产备注
        /// </summary>
        public string work_remark { get; set; }
        /// <summary>
        /// 提交创建机器详情
        /// </summary>
        public List<createmch> details { get; set; }
        /// <summary>
        /// 用户id
        /// </summary>
        public string baseuserid { get; set; }

    }
    /// <summary>
    /// 创建机器 详细项
    /// </summary>
    public class createmch
    {
        /// <summary>
        /// 柜体编号
        /// </summary>
        public int box_no { get; set; }
        /// <summary>
        /// 机器类型
        /// </summary>
        public Mch_Type? Mch_Type { get; set; }
        /// <summary>
        /// 机器类型
        /// </summary>
        public string mch_kid_type { get; set; }
        /// <summary>
        /// 机器类型id (选择时使用)
        /// </summary>
        public string mch_kid_type_id { get; set; }
        /// <summary>
        ///  货道模板ID
        /// </summary>
        public string template_id { get; set; }
        /// <summary>
        ///  实际货道设置
        /// </summary>
        public string slot_set { get; set; }
        /// <summary>
        /// 是否支持现金支付
        /// </summary>
        public bool can_cash { get; set; }
        /// <summary>
        /// 设置货柜颜色
        /// </summary>
        public string color { get; set; }
        /// <summary>
        /// 是否可以制冷
        /// </summary>
        public bool can_cold { get; set; }
        /// <summary>
        /// 是否可以制热
        /// </summary>
        public bool can_hot { get; set; }
        /// <summary>
        ///  是否可以负离子
        /// </summary>
        public bool can_anion { get; set; }
    }


    public class get_work_order_details_pagelist_params : Base_List_Params
    {
        public string baseusername { get; set; }
        public string mchname { get; set; }

        public string work_order_details_id { get; set; }

        public work_order_approval? work_approval_state { get; set; }

        public work_state? work_state { get; set; }
        public logistics_state? logistics_state { get; set; }
        /// <summary>
        ///  销售经理 ID
        /// </summary>
        public string uid { get; set; }
        /// <summary>
        /// 工期开始时间
        /// </summary>
        public string start_time { get; set; }
        /// <summary>
        /// 工期结束时间
        /// </summary>
        public string end_time { get; set; }
        /// <summary>
        /// 接单页面0  后续页面1 
        /// </summary>
        public int? posttype { get; set; }
    }
    public class get_work_order_details_pagelist_showlis
    {
        /// <summary>
        /// 销售经理
        /// </summary>
        public string u_name { get; set; }
        /// <summary>
        /// 工单ID
        /// </summary>
        public string work_order_id { get; set; }
        /// <summary>
        /// 下单商户
        /// </summary>
        public string baseuserid { get; set; }
        /// <summary>
        /// 下单商户名
        /// </summary>
        public string baseusername { get; set; }
        /// <summary>
        /// 添加时间
        /// </summary>
        public DateTime addtime { get; set; }
        /// <summary>
        /// 机器名称
        /// </summary>
        public string mch_name { get; set; }
        /// <summary>
        ///  机器ID
        /// </summary>
        public string mch_id { get; set; }
        public DateTime? work_end_time { get; set; }
        public string send_No { get; set; }

        /// <summary>
        /// 机器类型
        /// </summary>
        public string mch_kid_type { get; set; }
        /// <summary>
        /// 货道名称
        /// </summary>
        public string slot_template_name { get; set; }
        /// <summary>
        /// 生产单号
        /// </summary>
        public string work_order_details_id { get; set; }

        public string total_state_str { get { return total_state.Value.ToString(); } }
        /// <summary>
        /// 总体状态
        /// </summary>
        public sale_work_state_enum? total_state { get; set; }


        private work_order_approval? work_approval_state_pri;
        public string work_approval_state_str { get { return !work_approval_state_pri.HasValue ? "" : work_approval_state_pri.Value.ToString(); } }
        /// <summary>
        /// 工单审核状态
        /// </summary>
        public work_order_approval? work_approval_state { set { work_approval_state_pri = value; } }

        public string work_state_str { get { return !work_state.HasValue ? "" : work_state.Value.ToString(); } }
        /// <summary>
        /// 工作状态 
        /// </summary>
        public work_state? work_state { get; set; }


        private logistics_state? logistics_state_pri;
        public string logistics_state_str { get { return !logistics_state_pri.HasValue ? "" : logistics_state_pri.Value.ToString(); } }
        /// <summary>
        /// 物流状态
        /// </summary>
        public logistics_state? logistics_state { set { logistics_state_pri = value; } }
        /// <summary>
        /// 发货时间
        /// </summary>
        public DateTime? send_time { get; set; }
        /// <summary>
        /// 省
        /// </summary>
        public string province { get; set; }
        /// <summary>
        /// 市
        /// </summary>
        public string city { get; set; }
        /// <summary>
        /// 区
        /// </summary>
        public string district { get; set; }
        /// <summary>
        /// 地址
        /// </summary>
        public string address { get; set; }
        /// <summary>
        /// 审核完成时间
        /// </summary>
        public DateTime? approval_end_time { get; set; }
        /// <summary>
        /// 审核关闭时间
        /// </summary>
        public DateTime? approval_cloes_time { get; set; }
        /// <summary>
        /// 审核退回时间
        /// </summary>
        public DateTime? approval_back_time { get; set; }
        /// <summary>
        /// 生产单接单时间
        /// </summary>
        public DateTime? work_get_time { get; set; }
        /// <summary>
        /// 生成生产单时间
        /// </summary>
        public DateTime? create_order_time { get; set; }
        /// <summary>
        /// 生产中时间绑定机器码事件
        /// </summary>
        public DateTime? working_time { get; set; }
        /// <summary>
        /// 质检完成时间
        /// </summary>
        public DateTime? QA_end_time { get; set; }
        /// <summary>
        /// 实际生产完成时间
        /// </summary>
        public DateTime? true_work_end_time { get; set; }
        /// <summary>
        /// 生产关闭时间
        /// </summary>
        public DateTime? work_close_time { get; set; }
        /// <summary>
        /// 生产退回时间
        /// </summary>
        public DateTime? work_back_time { get; set; }


    }

    public class get_work_order_details_pagelist_showlisForwork : get_work_order_details_pagelist_showlis
    {
        public string sn { get; set; }

        public string iccid { get; set; }
    }
    public class search_sn
    {
        public string id { get; set; }

        public string SN { get; set; }

        public string iccid { get; set; }
    }
    public class start_work_params
    {
        public string[] work_order_ids { get; set; }
    }

    public class checkworkorder_model : sale_work_order_details
    {
        public string uid { get; set; }
        /// <summary>
        /// 销售名称
        /// </summary>
        public string u_name { get; set; }
        /// <summary>
        /// 客户ID
        /// </summary>
        public string baseuserid { get; set; }
        /// <summary>
        /// 客户名称
        /// </summary>
        public string baseusername { get; set; }

        public string mch_id { get; set; }
        /// <summary>
        /// 机器名称
        /// </summary>
        public string mch_name { get; set; }
        /// <summary>
        /// 工期日期
        /// </summary>
        public DateTime? work_end_time { get; set; }
        /// <summary>
        /// 当前订单状态
        /// </summary>
        public sale_work_state_enum total_state { get; set; }

        public string box_code { get; set; }

        public DateTime? create_order_time { get; set; }
    }
    public class sql_tran_params
    {
        public string sql { get; set; }
        public object model { get; set; }
    }
    public class slot_set
    {
        public int index { get; set; }

        public int maxcount { get; set; }

        public string height { get; set; }
    }
}
